﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace GFC
{
    [Serializable]
    public class Format
    {
        private List<Frame> m_Frames;
        private string m_Name;

        protected Format()
        {
            Frames = new List<Frame>();
        }

        public Format(string name)
        {
            Name = name;
            Frames = new List<Frame>();
        }

        public List<Frame> Frames
        {
            get { return m_Frames; }
            set { m_Frames = value; }
        }

        public string Name
        {
            get { return m_Name; }
            set { m_Name = value; }
        }

        public override bool Equals(object obj)
        {
            var format = obj as Format;
            if (format == null)
                return false;
            if (Name != format.Name)
                return false;
            if (Frames.Count != format.Frames.Count)
                return false;
            for (int i = 0; i < Frames.Count; i++)
            {
                if (!Frames[i].Equals(format.Frames[i]) || Frames[i].Format != this || format.Frames[i].Format != format)
                    return false;
            }
            return true;
        }
    }
}